import requests from './request.js';

// 获取这个用户所有信息
export const getUserInfoByAid = (userAid) => requests({
    url: `/user/getUserInfoByAid?userAid=${userAid}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 编辑用户的昵称
export const updateUserNickName = (data) => requests({
    url: `/user/updateUserNickName`,
    method: 'post',
    data: data,
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 查询用户的关注用户列表和被关注用户列表
export const queryUserConcernList = (data) => requests({
    url: `/user/queryUserConcernList`,
    method: 'get',
    params: data,
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 关注用户
export const concernUser = (aid) => requests({
    url: `/user-guanzhu/concernUser?userAid=${aid}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 取消关注用户
export const cancelConcernUser = (aid) => requests({
    url: `/user-guanzhu/cancelConcernUser?userAid=${aid}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 查询和对方聊天的所有记录
export const queryChatRecordInfo = (aid) => requests({
    url: `/chat/queryChatRecordInfo?userAid=${aid}`,
    method: 'get',
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 通过用户aid修改聊天记录页面里面的对方用户昵称
export const editChatUserNickName = (params) => requests({
    url: `/chat/editChatUserNickName`,
    method: 'post',
    data: params,
    headers: {
        token: localStorage.getItem('token'),
    }
});

// 发送给对方消息
export const sendMessageToChatObject = (params) => requests({
    url: `/chat/sendMessageToChatObject`,
    method: 'post',
    data: params,
    headers: {
        token: localStorage.getItem('token'),
    }
});